﻿using BlueWePush.Service.BaseService;
using BlueWePush.Service.WxModel.MarkdownTemplate;
using static BlueWePush.Service.BaseService.BlueWePushService;

namespace BlueWePush.Service.Test
{
    /// <summary>
    /// 测试用例,可根据用例自行调用
    /// </summary>
    public class LanJing
    {
        /// <summary>
        /// 获取token
        /// </summary>
        /// <returns></returns>
        public static string GetLanJingToken()
        {
            return BlueWePushService.GetToken("", "");
        }

        public static string token = "l7d_r4vnpHlzL8aKF4QjdTL0IpXL5MsqhrJdMwCtLF2g-bfVH3KVPA_56essKIoTz1ayxJgnsgPjhtqZNHsCKhtHrLWWU6C0lnKWIO8vguQJ892gqat2Cy7De7UtAcTW1R2Xd4w7le3D7tGQDPqgUSSXW7AcZHNO7TA_RPFRwYoxF8ap49IfTZEL9iPDHHrYdKNzuVWA2JlMfeLvEW8qOw";

        /// <summary>
        /// 发送消息
        /// </summary>
        /// <returns></returns>
        public static string SendLanJingMessage()
        {
            var body = new MarkDownMessageModel
            {
                Agentid = 1000002,
                Touser = "ChenHaiFeng",
                markdown = new MarkDownContent
                {
                    Content = CreateMarkDownMsg("BUG", "1002", "0682", "01", "孙悟空", "非法入侵")
                }
            };

            var result = BlueWePushService.SendMessage(token, body);

            if (result.errcode != 0)
            {
                return result.errmsg;
            }

            return "ok";
        }
    }
}